package com.gougou.service.impl;

import com.alicp.jetcache.anno.Cached;
import com.gougou.mapper.MybatisMapper;
import com.gougou.pojo.TbItem;
import com.gougou.pojo.TbItemCat;
import com.gougou.pojo.TbOrder;
import com.gougou.service.MybatisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * Created by EX-ZHANZHENQIANG001 on 2018-05-03.
 */
@Service
public class MybatisServiceImpl implements MybatisService {

    @Autowired
    private MybatisMapper mybatisMapper;


    @Override
    @Transactional
    @Cached(name="MybatisService.queryItem", expire = 3600)
    public List<TbItem> queryItem(Map<String, String> param) {
        return mybatisMapper.queryItem(param);
    }

    @Override
    public List<TbItemCat> queryItemCat(Map<String, Object> param) {
        return mybatisMapper.queryItemCat(param);
    }


    @Override
    public List getItemCatChild(Map<String, String> param) {
        String result  = mybatisMapper.getItemCatChild(param);
        List resultList = Arrays.asList(result.split(","));
        return resultList;
    }


}
